load("@fbsource//tools/build_defs:rust_binary.bzl", "rust_binary")
load("@fbsource//tools/build_defs:rust_library.bzl", "rust_library")

oncall("sapling")

rust_library(
    name = "dev-logger",
    srcs = glob(["src/**/*.rs"]),
    autocargo = {"cargo_toml_config": {
        "lib": {"name": "dev-logger"},
        "package": {
            "authors": ["Meta Source Control Team <sourcecontrol-dev@meta.com>"],
            "description": "Print or examine tracing output in unit tests.",
            "homepage": "https://sapling-scm.com/",
            "license": "MIT",
            "name": "sapling-dev-logger",
            "repository": "https://github.com/facebook/sapling",
        },
    }},
    crate_root = "src/lib.rs",
    deps = [
        "fbsource//third-party/rust:ctor",
        "fbsource//third-party/rust:tracing",
        "fbsource//third-party/rust:tracing-subscriber",
    ],
)

rust_binary(
    name = "test",
    srcs = ["examples/test.rs"],
    autocargo = {"ignore_rule": True},
    unittests = False,
    deps = [
        "fbsource//third-party/rust:tracing",
        ":dev-logger",
    ],
)
